<script setup>
import { ref } from "vue";
import VEditorInline from "@/components/VEditorInline/index.vue";

defineOptions({
  name: "_editor",
});

// 为VEditorInline添加数据绑定
const inlineEditorContent = ref("");

const handleInlineEditorChange = (content) => {
  console.log("App.vue Inline编辑器内容变化：", content);
};
</script>

<template>
  <div class="app-container">
    <VEditorInline
      v-model="inlineEditorContent"
      :aiEnabled="true"
      height="calc(100vh - 140px)"
      :width="'100%'"
      :placeholder="'点击这里开始编辑内容...'"
      @change="handleInlineEditorChange"
    />
  </div>
</template>

<style scoped>
.app-container {
  width: 100%;
  margin: 0 auto;
}

.component-selector {
  display: flex;
  gap: 10px;
  margin-bottom: 30px;
  justify-content: center;
  flex-wrap: wrap;
}

.selector-btn {
  padding: 12px 20px;
  background: #f0f0f0;
  color: #333;
  border: 2px solid #ddd;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  transition: all 0.3s ease;
}

.selector-btn:hover {
  background: #e0e0e0;
  border-color: #bbb;
}

.selector-btn.active {
  background: #007cba;
  color: white;
  border-color: #007cba;
}

.app-editor-section {
  margin-bottom: 40px;
  padding: 20px;
  border: 2px solid #2196f3;
  border-radius: 8px;
  background: #f3f8ff;
}

.app-editor-section h2 {
  margin-top: 0;
  color: #1976d2;
  border-bottom: 2px solid #2196f3;
  padding-bottom: 10px;
}

.editor-description {
  color: #666;
  font-style: italic;
  margin-bottom: 20px;
}

.content-preview {
  margin-top: 20px;
  padding: 15px;
  background: white;
  border: 1px solid #ddd;
  border-radius: 4px;
}

.divider {
  margin: 40px 0;
  border: none;
  border-top: 2px solid #e0e0e0;
}

@media (max-width: 768px) {
  .component-selector {
    flex-direction: column;
    align-items: center;
  }

  .selector-btn {
    width: 100%;
    max-width: 300px;
  }
}
</style>
